package com.czxy.demo15;

import java.util.ArrayList;

public class Test01 {
    public static void main(String[] args) {
        String str = "<Dog name='小白' color='白色'  sons='小黑,小花'/>";
        String s = str.replace("<Dog name='", "").replace("' color='", " ").replace("'  sons='", " ").replace("'/>", "");
        String[] ss = s.split(" ");
        String[] sp = ss[2].split(",");
        ArrayList<String> list = new ArrayList<>();
        for (String s1 : sp) {
            list.add(s1);
        }
        Dog dog = new Dog(ss[0], ss[1], list);
        System.out.println(dog);
    }
}
